Due to its favorable extensibility and robustness, a Peer-to-Peer (P2P) system has become a perfect platform for developing streaming media services. In a tracker-based P2P system, there exist a large number of trackers; for different play channels, a tracker buffers peer information, such as an IP address and a port, of peers related to data; a peer that is newly added to the P2P streaming media system needs to report its own peer information, such as an IP address and a port, to the tracker.
A peer that has been added to the P2P streaming media system may send a Peerlist request to the tracker, for indicating that it wants to download data from other peers. A peer that sends a Peerlist request is referred to as a request peer, and a peer that provides download data to the request peer is referred to as an active peer. In the existing tracker-based P2P system, a process in which a request peer searches an active peer is as shown FIG. 1, which includes the following steps.
Step 1: A request peer (Peer_1) sends a Peerlist request to a tracker, the tracker selects a plurality of peers according to the buffered peer information, writes the peer information of the selected peers into a Peerlist and returns the Peerlist to the request peer.
In this step, the tracker may determine the peers according to the buffered peer information, and randomly select a certain number of peers therefrom, or it may select the peers that are adjacent to the request peer according to the principle of geographic location adjacency. For example, if it is determined according to the IP address of the request peer that the home area of the request peer is Beijing, the tracker may select the peers with a home area of Beijing according to the buffered IP addresses, for example, Peer_2, Peer_3, Peer_4 and Peer_5 are selected in FIG. 1.
Step 2: After the request peer receives the Peerlist, it sends sounding information to the peers in the Peerlist for determining the active peer.
In a P2P streaming media system, a play document is divided into several subblocks, and the play document is transmitted between peers in the unit of a subblock, and a peer indicates the situation that it buffers the subblocks via a bitmap. Each bit in the bitmap corresponds to a subblock. If a peer buffers a certain subblock, the bit corresponding to the subblock in the bitmap is set as “1”; otherwise, the bit is set as “0”. In this step, the request peer first sends sounding information to a certain peer in the Peerlist; for example, Peer_1 sends sounding information to Peer_2 and queries the connection capability of Peer_2, and when Peer_2 is capable of acting as an active peer of Peer_1, Peer_1 and Peer_2 interchange their own bitmaps and learn the situation of buffered subblocks of the opposite party. Peer_2 determines according to the received bitmap whether the subblocks it buffers can be provided to Peer_1, if yes, it sends successful response information to Peer_1; otherwise, it sends failed response information to Peer_1.
Additionally, the request peer and the peers in the Peerlist may interchange their Peerlists for enlarging the searching area of the active peers.
By the above two steps, the request peer accomplishes the process of searching the active peer, and then Step 3 may be performed: the request peer Peer_1 downloads data from the active peer Peer_2 and prepares to play a video.
In the mode for searching an active peer in the existing tracker-based P2P system, because the tracker only knows the peer information, such as an IP address and a port, of a selectable peer, a peer in the Peerlist may be a peer buffering less available subblocks, which makes the request peer need to send sounding information to each peer in the Peerlist respectively, thus the request peer may need to occupy a large number of communication resources to search a suitable active peer, and the communication resources may be wasted. Moreover, because the tracker does not know the characters of the networks in which the peers in the system exist, it only coarsely selects a peer according to the physical addresses of the peers, thus the peer corresponding to the peer information in the Peerlist received by the request peer is likely a peer with a low data transmission speed. When such a peer with a low data transmission speed becomes an active peer of the request peer, the data transmission efficiency will be low, thereby the average delay required by the request peer to play streaming media data will be increased.